<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/16
 * Time: 18:56
 */

class db{
    private static $obj=null;
    private function _construct(){

    }
    static function getObj(){
        if (is_null(self::$obj))
        {
            self::$obj=new db();
        }
        return self::$obj;
    }
}
var_dump(db::getObj());
var_dump(db::getObj());